<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
    <head>
    <th:block th:include="include :: header('手工拉取有赞订单')" />
</head>
<body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
    <section class="section-content">
        <div class="row">
            <div class="col-xs-9" style="padding-left: 0px">
                <div class="ibox float-e-margins">
                    <div class="ibox-title ibox-title-gray dashboard-header">
                        <h5>基本资料</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="#pull_orders" data-toggle="tab" aria-expanded="true">拉取订单</a></li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane active" id="pull_orders" th:object="${order}">
                                    <form class="form-horizontal" id="form-order-list">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">开始时间：</label>
                                            <div class="col-sm-6">
                                                <input type="text" class="time-input" id="startTime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" placeholder="开始时间" name="createTime" th:value="*{#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">结束时间：</label>
                                            <div class="col-sm-6">
                                                <input type="text" class="time-input" id="endTime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" placeholder="结束时间" name="updateTime" th:value="*{#dates.format(updateTime, 'yyyy-MM-dd HH:mm:ss')}"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <button type="button" class="btn btn-sm btn-primary" onclick="submitPull()"><i class="fa fa-check"></i>拉 取</button>&nbsp;
                                                <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    function submitPull() {
        $.operate.asynPost(ctx + "customs/youzan/pull", $('#form-order-list').serialize(), function (data) {
            if (data) {
                if (data.code == 0 && data.data){                    
                    $.modal.confirm(data.msg, function () {
                        var tabObj = data.data;
                        if (tabObj) {
                            $.modal.openTab(tabObj.title, tabObj.url);
                        }
                    });
                } else {
                    $.modal.msg(data.msg);
                }
            }
        });
    }
</script>
</body>
</html>
